/**
 * Created by Administrator on 2017/2/7.
 */
$(function(){
    if (getQueryString('key') != '') {
        var key = getQueryString('key');
        var username = getQueryString('username');
        addCookie('key', key);
        addCookie('username', username);
    } else {
        var key = getCookie('key');
    }
    if(key){
        $.ajax({
            type:'post',
            url:ApiUrl+"/index.php?act=member_promotion",
            data:{key:key},
            dataType:'json',
            //jsonp:'callback',
            success:function(result){
                console.log(result);
                var brokerStates = result['datas']['promotion_info']['brokerageStates'];
                var brokerageList = result['datas']['promotion_info']['brokerageList'];
                 // 开始渲染页面
                 var r_text = "<div id='r_text'><p>推广佣金</p>￥" +brokerStates['brokerage']+ "</div>";
                 document.getElementById('t1').innerHTML = r_text;

                 var List_text = "";
                 for(var i=0;i<brokerageList.length;i++){
                        List_text+=""
                 }
            }
        });
    } else {
        var html = '<span class="left"><a href="##">151</a></span><span class="right"><a href="##">充值</a></span><p><img class="touxiang"src="/data/upload/shop/common/default_user_portrait.gif"></p><div class="gologin"><a href="'+WapSiteUrl+'/tmpl/member/login.html">立即登录</a></div>';
        //
        $(".center").html(html);

        return false;
    }

    //滚动header固定到顶部
    //$.scrollTransparent();
});